<template>
  <div id="earlyStageAchievementOpinion1" class="tongyongBox">
    <div class="box">
      <el-tabs v-model="flag" @tab-click="handleClick">
        <el-tab-pane label="基本信息" name="1"></el-tab-pane>
        <el-tab-pane label="审查流程" name="2"></el-tab-pane>
      </el-tabs>
      <div class="MainBox1" v-show="flag=='2'">
        <optionList :optionListCode="optionListCode" />
      </div>
      <div class="mainBox" v-show="flag=='1'">
        <div class="basicInfo">
          <div class="basicInfo_title">基本信息</div>
          <div class="basicInfo_content">
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">项目名称：</p>
                  <p class="pContent">{{urbanInfo.projectName}}</p>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">位置：</p>
                  <p class="pContent">{{urbanInfo.projectName}}</p>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">图幅号：</p>
                  <p class="pContent">{{urbanInfo.tfh}}</p>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">工期：</p>
                  <p class="pContent">{{urbanInfo.constructingPeriod}}</p>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">建设用地复垦规模合计：</p>
                  <p class="pContent">{{urbanInfo.jsydfkgmhj}}</p>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">宅基地房屋占地面积：</p>
                  <p class="pContent">{{urbanInfo.nczjd}}公顷</p>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">宅基地附属用地面积：</p>
                  <p class="pContent">{{urbanInfo.zjdfs}}公顷</p>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">其他建设用地：</p>
                  <p class="pContent">{{urbanInfo.qt}}公顷</p>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">预计减少建设用地：</p>
                  <p class="pContent">{{urbanInfo.yjjsj}}公顷</p>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_row">
                  <p class="pTitle">预计增加农用地合计：</p>
                  <p class="pContent">{{urbanInfo.yjzjn}}公顷</p>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>

        <div class="basicInfo">
          <div class="basicInfo_title">投资预算信息</div>
          <div class="basicInfo_content">
            <el-row :gutter="20">
              <el-col :span="2">
                <p class="freeTitle">工程施工费</p>
                <!-- 工程施工费{{urbanInfo.constructionCost}}万元 -->
              </el-col>
              <el-col :span="22">
                <el-row :gutter="20">
                  <el-col :span="8">
                    <div class="boxItem_content_row">
                      <p class="pTitle">拆除工程费：</p>
                      <p class="pContent">{{urbanInfo.demolitionCost}}万元</p>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_row">
                      <p class="pTitle">土地平整工程费：</p>
                      <p class="pContent">{{urbanInfo.landLevelingCost}}万元</p>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_row">
                      <p class="pTitle">农田水利工程费：</p>
                      <p class="pContent">{{urbanInfo.farmlandWaterConservancyCost}}万元</p>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20" class="el_row">
                  <el-col :span="8">
                    <div class="boxItem_content_row">
                      <p class="pTitle">田间道路工程费：</p>
                      <p class="pContent">{{urbanInfo.fieldRoadCost}}万元</p>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_row">
                      <p class="pTitle">其它施工费：</p>
                      <p class="pContent">{{urbanInfo.otherConstructingCost}}万元</p>
                    </div>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
            <el-row :gutter="20" class="boxItem_content_row marginBottom">
              <el-col :span="2">
                <p class="freeTitle">其他费用</p>
              </el-col>
              <el-col :span="22">
                <p class="freeTitle">{{urbanInfo.otherCost}}万元</p>
              </el-col>
            </el-row>
            <el-row :gutter="20" class="boxItem_content_row marginBottom">
              <el-col :span="2">
                <p class="freeTitle">不可预见费用</p>
              </el-col>
              <el-col :span="22">
                <p class="freeTitle">{{urbanInfo.unforeseeableExpenses}}万元</p>
              </el-col>
            </el-row>
            <el-row :gutter="20" class="boxItem_content_row marginBottom">
              <el-col :span="2">
                <p class="freeTitle">补偿费</p>
              </el-col>
              <el-col :span="22">
                <p class="freeTitle">{{urbanInfo.compensation}}万元</p>
              </el-col>
            </el-row>
            <el-row :gutter="20" class="boxItem_content_row marginBottom">
              <el-col :span="2">
                <p class="totalMoney">合计</p>
              </el-col>
              <el-col :span="22">
                <p class="totalMoney">{{urbanInfo.totalCost}}万元</p>
              </el-col>
            </el-row>
          </div>
        </div>

        <div class="basicInfo">
          <div class="basicInfo_title">审查意见信息</div>
          <div class="basicInfo_content basicInfo_options">
            <div class="options">
              <p>耕保处经办人意见</p>
              <div class="boxItem_content_row_item_noFlex_textarea">
                <el-input type="textarea" :rows="3" readonly v-model="gengbaoOpinion"></el-input>
              </div>
              <el-row class="options_row">
                <el-col :span="8">
                  <div class="options_row_title">
                    <p>经办人：</p>
                    <div class="options_row_img">
                      <img :src="$https+gengbaoren" alt />
                      <!-- <el-input :disabled="true" v-model="gengbaoren" suffix placeholder="请输入内容"></el-input> -->
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="options_row_title">
                    <p>经办日期：</p>
                    <el-date-picker
                      v-model="gengbaoDate"
                      type="date"
                      readonly
                      value-format="yyyy-MM-dd"
                      placeholder="选择日期时间"
                    ></el-date-picker>
                  </div>
                </el-col>
                <!-- <el-col :span="8">
                  <div class="options_row_title">
                    <p>审查状态：</p>
                    <el-select v-model="gengbaoStatus" disabled placeholder="请选择">
                    <el-option label="同意" value="APPROVED"></el-option>
                    <el-option label="拒绝" value="REJECTED"></el-option>
                  </el-select>
                  </div>
                </el-col>-->
              </el-row>
            </div>
            <div class="options">
              <p>耕保处审核人意见</p>
              <div class="boxItem_content_row_item_noFlex_textarea">
                <el-input type="textarea" :rows="3" v-model="shenheOpinion" :readonly="isReadonly"></el-input>
              </div>
              <el-row class="options_row">
                <el-col :span="8">
                  <div class="options_row_title">
                    <p>审核人：</p>
                    <div class="options_row_img">
                      <img :src="$https+shenheren" alt />
                      <!-- <el-input :disabled="true" v-model="shenheren" suffix placeholder="请输入内容"></el-input> -->
                    </div>
                  </div>
                </el-col>
                <el-col :span="8">
                  <div class="options_row_title">
                    <p>审核日期：</p>
                    <el-date-picker
                      v-model="shenheDate"
                      type="date"
                      :readonly="isReadonly"
                      value-format="yyyy-MM-dd"
                      placeholder="选择日期时间"
                    ></el-date-picker>
                  </div>
                </el-col>
                <el-col :span="8" v-if="!isReadonly">
                  <div class="options_row_title">
                    <p>审核状态：</p>
                    <el-select v-model="shenheStatus" placeholder="请选择">
                      <el-option label="同意" value="APPROVED"></el-option>
                      <el-option label="拒绝" value="REJECTED"></el-option>
                    </el-select>
                  </div>
                </el-col>
              </el-row>
            </div>
          </div>
        </div>
        <div class="btn" v-if="isSjywcsfzrBtn">
          <el-button size="medium" @click="btnShenHeren" type="primary" :loading="isLoading">提交</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  queryUrbanInfo,
  saveAuditorOpinion,
  queryJuOpinion
} from "@/api/storeForRecordSee";
import { getTime } from "@/api/getTime";
import { findById } from "@/api/common";
import optionList from "@/components/optionList";
export default {
  components: {
    optionList
  },
  data() {
    return {
      //测试数据（意见列表）
      optionListCode: "StoringRecordSecondAudit",
      flag: "1",
      input: "",
      value1: "",
      urbanInfo: "",
      shenheren: "", //耕保审核人
      shenheDate: "", //耕保审核日期
      shenheStatus: "", //状态
      shenheOpinion: "", //审核意见

      gengbaoren: "", //耕保经办人
      gengbaoDate: "", //耕保经办日期
      gengbaoStatus: "", //状态
      gengbaoOpinion: "", //耕保经办人意见

      isLoading: false,

      isReadonly: false,
      isSjywcsfzrBtn: false,
      userIcon: "" //用户签名照
    };
  },
  created() {
    this.shenheDate = getTime();
    this.getInfo();
    this.getJuOpinion();
    if (
      localStorage.getItem("router") ==
      "STORING_RECORD_THIRD_AUDIT_SECOND_OPINION"
    ) {
      this.isSjywcsfzrBtn = true;
      this.isReadonly = false;
      if (localStorage.getItem("menusName") == "ROLE_SJYWCSFZR") {
        this.isReadonly = false;
        this.isSjywcsfzrBtn = true;
      } else {
        this.isReadonly = true;
        this.isSjywcsfzrBtn = false;
      }
    } else {
      this.isReadonly = true;
      this.isSjywcsfzrBtn = false;
    }
    if (localStorage.getItem("lookStatus") == 2) {
      this.isReadonly = true;
      this.isSjywcsfzrBtn = false;
    }
  },
  methods: {
    //切换选项卡
    handleClick(tab, event) {
      console.log(tab, event);
    },
    //获取用户信息
    userInfo() {
      var data = {
        id: localStorage.getItem("userId")
      };
      findById(data).then(res => {
        console.log(res, "用户信息");
        this.userIcon = res.data.signedPhoto;
      });
    },
    getJuOpinion() {
      let obj = {
        projectId: localStorage.getItem("projectId")
      };
      queryJuOpinion(obj).then(res => {
        this.gengbaoDate = res.data.agentAuditDate;
        this.gengbaoStatus = res.data.agentAuditResult;
        this.gengbaoOpinion = res.data.agentOpinion;
        this.gengbaoren = res.data.agentDto.signedPhoto;

        this.shenheDate =
          res.data.auditorAuditDate != null
            ? res.data.auditorAuditDate
            : getTime();
        this.shenheStatus = res.data.auditorAuditResult;
        this.shenheOpinion = res.data.auditorOpinion;
        this.shenheren =
          res.data.auditor != null
            ? res.data.auditor.signedPhoto
            : this.$store.state.user.userInfo.signedPhoto;
      });
    },

    btnShenHeren() {
      let obj = {
        projectId: localStorage.getItem("projectId"),
        opinion: this.shenheOpinion,
        auditorId: localStorage.getItem("userId"),
        auditDate: this.shenheDate,
        auditResult: this.shenheStatus
      };
      this.isLoading = true;
      saveAuditorOpinion(obj)
        .then(res => {
          this.isLoading = false;
          if (res.code == 1000) {
            this.$alert("当前流程办理完成", "提示", {
              confirmButtonText: "确定",
              callback: action => {
                this.$router.push({
                  path: "/xmkgh/ywdeal"
                });
              }
            });
            this.getJuOpinion();
            this.$refs.optionList.getProgress();
          }
        })
        .catch(error => {
          this.isLoading = false;
        });
    },
    getInfo() {
      //查询项目基本信息和预算投资信息-----市局
      let obj = {
        projectId: localStorage.getItem("projectId")
      };
      queryUrbanInfo(obj).then(res => {
        this.urbanInfo = res.data;
      });
    },

    toSeeTable(type) {
      if (type == 1) {
        this.flag = 2;
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.form /deep/ .el-input__inner {
  width: 200px;
}
</style>

<style lang="scss" scoped>
.tongyongBox {
  padding: 20px;
  box-sizing: border-box;
}
.basic1 {
  padding-left: 150px;
}
.box {
  border-top: none;
  border-radius: 5px;
  // background: #fff;
  .box_ifram {
    width: 600px;
    height: 400px;
    border: 1px solid black;
    position: fixed;
    top: 50%;
    left: 50%;
    margin-left: -25%;
    margin-top: -10%;
  }

  .basicInfo {
    border-left: 1px solid #efefef;
    border-right: 1px solid #efefef;
    .basicInfo_title {
      height: 50px;
      background: #f8f8f8;
      padding: 0px 30px;
      line-height: 50px;
      color: #333;
      font-size: 18px;
      font-weight: bold;
      border-top: 1px solid #efefef;
      border-bottom: 1px solid #efefef;
    }

    .basicInfo_content {
      padding: 30px 40px;

      .select_bxo {
        display: flex;
        align-items: center;
        margin-bottom: 20px;
        div {
          font-size: 14px;
          color: #444;
        }
        .input {
          width: 200px;
          margin: 0px 20px 0px 10px;
        }
      }
      /deep/ .el_row {
        margin-bottom: 30px;
        div {
          font-size: 13px;
          color: #606266;
          display: flex;
          align-items: center;
          b {
            color: #444444;
          }
          strong {
            color: #444444;
          }
        }
      }
    }

    .basicInfo_content_title {
      display: flex;
      // justify-content: space-between;
    }
    .basicInfo_two {
      /deep/ .el_row {
        .basicInput {
          .basicInput_title {
            width: 150px;
          }
          .basicInput_title1 {
            width: 150px;
          }
        }
      }
    }
  }
  .basic_row {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #444;
    font-weight: bold;
    margin-bottom: 25px;
    span {
      margin-right: 20px;
    }
  }
  .basicInfo_options {
    padding: 0px 40px;
    .options {
      font-size: 13px;
      font-weight: bold;
      color: #444;
      .options_select {
        margin: 10px 0px;
      }
      .options_row {
        margin-top: 15px;
        display: flex;
        align-items: center;
        .options_row_title {
          display: flex;
          align-items: center;

          .options_row_img img {
            width: 105px;
            height: 59px;
            margin-left: 20px;
          }
        }
      }
    }
  }

  .btn {
    // text-align: center;
    margin-bottom: 20px;
    margin-left: 50px;
  }
}
#earlyStageAchievementOpinion1 {
  padding: 30px;
  box-sizing: border-box;
}
#earlyStageAchievementOpinion1 .boxItem {
  width: 100%;
  background-color: #fff;
}
#earlyStageAchievementOpinion1 .boxItem_title {
  width: 100%;
  background: #f8f8f8;
  height: 50px;
  border: 1px solid #efefef;
  overflow: hidden;
  color: #333;
  font-size: 18px;
  font-weight: bold;
  text-indent: 20px;
  line-height: 50px;
}
#earlyStageAchievementOpinion1 .boxItem_content {
  width: 100%;
  border: 1px solid #ebebeb;
  border-top: none;
  padding: 30px;
  padding-top: 0;
  box-sizing: border-box;
}
#earlyStageAchievementOpinion1 .boxItem_content_row {
  display: flex;
  align-items: center;
  line-height: 22px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item {
  display: flex;
  align-items: center;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item_noFlex {
  display: flex;
  width: 100%;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item:nth-child(2n-1) {
  margin-right: 300px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item p {
  font-size: 14px;
  line-height: 36px;
  width: 165px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item_noFlex p {
  font-size: 14px;
  line-height: 36px;
  width: 140px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item p:first-child {
  color: #444;
  font-weight: bold;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item p:last-child {
  color: #666;
}
#earlyStageAchievementOpinion1 .uploadDownLoadBox_item {
  margin: 20px 0;
}
#earlyStageAchievementOpinion1 .uploadDownLoadBox_item p {
  width: 140px;
}
#earlyStageAchievementOpinion1 .button_box {
  margin-top: 54px;
}
#earlyStageAchievementOpinion1 .button_box_item {
  margin-right: 10px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item_input {
  position: relative;
}
#earlyStageAchievementOpinion1 /deep/ .el-input__inner {
  padding-right: 50px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item_input span {
  position: absolute;
  right: 10px;
  top: 3px;
  height: 36px;
  line-height: 36px;
  z-index: 1;
  color: #999;
}
#earlyStageAchievementOpinion1 .table-doc-view {
  border-collapse: collapse;
}
#earlyStageAchievementOpinion1 .table-doc-view tr,
.table-doc-view td {
  border: 1px solid #ccc;
  padding: 10px 10px;
}
#earlyStageAchievementOpinion1 .table-doc-view tr,
.table-doc-view td {
  border: 1px solid #ccc;
  padding: 10px 10px;
}
#earlyStageAchievementOpinion1 .table-doc-view td {
  font-size: 14px;
  color: #444;
  min-height: 30px;
}
#earlyStageAchievementOpinion1 .table-doc-view .taoc-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}
#earlyStageAchievementOpinion1 .table-doc-view .taoc-center {
  text-align: center;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_item_noFlex_textarea {
  width: 80%;
}
#earlyStageAchievementOpinion1 .shencharen {
  display: flex;
  margin-right: 300px;
}
#earlyStageAchievementOpinion1 .shencharen img {
  width: 105px;
  height: 59px;
}
#earlyStageAchievementOpinion1 .shencharenTime {
  display: flex;
  align-items: center;
}
#earlyStageAchievementOpinion1 .shencharenTime p {
  width: 80px;
}
#earlyStageAchievementOpinion1 .boxItem_content_row_shenhe {
  margin: 30px 0;
}
#earlyStageAchievementOpinion1 .tableBoxData_title {
  width: 100%;
  display: block;
  overflow: hidden;
  font-size: 20px;
  font-weight: bold;
  color: #444;
  text-align: center;
  margin-bottom: 10px;
}
.tableBoxData_mainData {
  width: 100%;
  display: flex;
  justify-content: center;
}
.tableBoxData_button_box {
  display: flex;
  justify-content: center;
}
.tableBoxData_button_box_item {
  margin: 0px 20px;
  margin-bottom: 20px;
  margin-top: 10px;
}
.table-doc-view .taoc-nowrap {
  white-space: nowrap;
}
.boxItem_content_row_item_noFlex_textarea {
  width: 90%;
}

.pTitle,
.options_row_title p,
.options p {
  font-size: 14px;
  color: #606266;
  font-weight: bold;
}
.pTitle {
  margin-right: 10px;
}
.pContent {
  font-size: 14px;
  color: #606266;
}
.freeTitle {
  font-size: 15px;
  font-weight: bold;
  color: #666;
}
.totalMoney {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
</style>
